import type { DropMenu } from '../components/Dropdown';
import type { LocaleSetting, LocaleType } from '/#/config';
import type { SelectProps } from 'ant-design-vue';
import { useI18n } from '../hooks/web/useI18n';

// export const LOCALE: { [key: string]: LocaleType } = {
//   ZH_CN: 'zh_CN', // 中文
//   EN_US: 'en_US', // 英文
//   PT_BR: 'pt_BR', // 葡萄牙语
//   VI_VN: 'vi_VN', // 越南语
//   TH_TH: 'th_TH',
// };

export enum LOCALE {
  ZH_CN = 'zh_CN', // 中文
  EN_US = 'en_US', // 英文
  PT_BR = 'pt_BR', // 葡萄牙语
  VI_VN = 'vi_VN', // 越南语
  TH_TH = 'th_TH',
  HI_IN = 'hi_IN',
}

export const localeSetting: LocaleSetting = {
  showPicker: true,
  // Locale
  locale: LOCALE.ZH_CN,
  // Default locale
  fallback: LOCALE.ZH_CN,
  // available Locales
  availableLocales: [LOCALE.ZH_CN, LOCALE.EN_US],
};

// locale list
export function useLocalList() {
  const { t } = useI18n();
  const localeList: DropMenu[] = [
    {
      label: t('common.common_zh_CN'),
      text: t('common.common_zh_CN'),
      country: '中国',
      event: LOCALE.ZH_CN,
      language: 'zh-CN',
    },
    {
      label: t('common.common_en_US'),
      text: t('common.common_en_US'),
      country: '欧美',
      event: LOCALE.EN_US,
      language: 'en',
    },
    {
      label: t('common.common_vi_VN'),
      text: t('common.common_vi_VN'),
      country: '越南',
      event: LOCALE.VI_VN,
      language: 'vi',
    },
    {
      label: t('common.common_pt_BR'),
      text: t('common.common_pt_BR'),
      event: LOCALE.PT_BR,
      country: '巴西',
      language: 'pt',
    },
    {
      label: t('common.common_th_TH'),
      text: t('common.common_th_TH'),
      country: '泰国',
      event: LOCALE.TH_TH,
      language: 'th',
    },
    {
      label: t('common.common_hi_IN'),
      text: t('common.common_hi_IN'),
      country: '印度',
      event: LOCALE.HI_IN,
      language: 'hi',
    },
  ];
  return localeList;
}

export function useLocalLangurage() {
  const { t } = useI18n();
  const localeListLangurage = {
    zh_CN: t('common.common_zh_CN'),
    en_US: t('common.common_en_US'),
    vi_VN: t('common.common_vi_VN'),
    pt_BR: t('common.common_pt_BR'),
    th_TH: t('common.common_th_TH'),
    hi_IN: t('common.common_hi_IN'),
  };
  return localeListLangurage;
}



export enum TIMEZONE {
  ETC = 'Etc/GMT',
  BRT = 'America/Sao_Paulo',
  CST = 'Asia/Shanghai',
  THAILAND = 'Asia/Bangkok',
  VIETNAM = 'Asia/Ho_Chi_Minh',
  INDIA = 'Asia/Kolkata',
  USA = 'America/New_York',
}

export const timezoneList: SelectProps['options'] = [
  { label: '中国 UTC+8', value: TIMEZONE.CST, time_zone: 'zh_CN', time_type: 'zh-CN' },
  { label: '巴西 UTC-3', value: TIMEZONE.BRT, time_zone: 'pt_BR', time_type: 'pt-BR' },
  { label: '越南 UTC+7', value: TIMEZONE.VIETNAM, time_zone: 'vi_VN', time_type: 'vi-VN' },
  { label: '印度 UTC+5:30', value: TIMEZONE.INDIA, time_zone: 'hi_IN', time_type: 'hi-IN' },
  { label: '世界 UTC+0', value: TIMEZONE.ETC, time_zone: 'utc', time_type: 'utc' },
  { label: '美东时间 UTC-4', value: TIMEZONE.USA, time_zone: 'en_US', time_type: 'en-US' },
];
